
const retUtil = require('../../../utils/retUtil');
const CONST = require('../../../utils/const');

const IGNORE_URIS = [
    "/yjx/v1/promoter/users/checkBalkMobileCode",
    "/yjx/v1/promoter/users/getBackMobileVerCode"
];

module.exports = async (ctx, next) => {

    const uri = ctx.req.url.split('?')[0];
    if(IGNORE_URIS.includes(uri)) {
        await next();
        return;
    }
    const user = ctx.session[CONST.SESSION_USER];
    if(!user) {
        throw new Error('权限不足');
    }
    await next();
};